package com.zygh.lz.controller.app;

import com.alibaba.fastjson.JSONObject;
import com.zygh.lz.service.ProblemTypeService;
import com.zygh.lz.service.StaffService;
import com.zygh.lz.stapprove.InBean;
import com.zygh.lz.stapprove.OutBean;
import com.zygh.lz.stapprove.OutBeanUtil;
import com.zygh.lz.stapprove.ViLog;
import com.zygh.lz.vo.ResultBean;
import com.zygh.lz.vo.ResultBeans;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Api(tags = "APP问题类型模块", description = "AppProblemTypeController")
@RestController
public class AppProblemTypeController {
    @Autowired
    private ProblemTypeService problemTypeService;
    @Resource
    private StaffService staffService;

    @ApiOperation("查询所有问题类型")
    @PostMapping("selectAllByProblemtype")
    @ViLog(logType = "1", module = "问题类型>查询所有问题类型")
    public OutBean selectAllByProblemtype(@RequestBody(required = false) InBean inBean) {
        ResultBeans resultBean = problemTypeService.selectAllByProblemtype();
        return OutBeanUtil.resSuc(resultBean, inBean);
    }


    @ApiOperation("默认人")
    @PostMapping("selectdefault")
    @ViLog(logType = "1", module = "查询默认人")
    public OutBean selectdefault(String probleDetail, @RequestBody(required = false) InBean inBean) {
        JSONObject jsonObject = inBean.convertObj(JSONObject.class);
        ResultBeans selectdefault = staffService.selectdefault(jsonObject.getString("probleDetail"));
        return OutBeanUtil.resSuc(selectdefault, inBean);
    }


}
